<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <p><input type="text" id="search" value="百度一下，你就知道！"></p>
    <script>
        // 1获取元素
        var search = document.querySelector("#search")
        // 2绑定事件 获取焦点事件
        search.onfocus = function(){
            // alert(1)
            // 判断
            if(this.Value == "百度一下，你就知道！"){
                this.Value = ""
            }
        }
    // 失去焦点
        search.onblur = function(){
            if(this.Value == ""){
                this.Value = "百度一下，你就知道！"
            }
        }
    </script>
</body>
</html>